aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/receive
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-07 21:16:25 -0800
committerAdam Soltys <[email protected]>2024-11-08 09:27:40 -0800
commit32fcc461cd43c8907df5e306d520bb671307eab1 (patch)
tree0253780c569998b6c1a5f43026586e94916c3fee /src/routes/(app)/[username]/receive
parentbe5aa52cea1d57c875cfb22d25c6a866b8de2239 (diff)
downloadcoinos-ui-32fcc461cd43c8907df5e306d520bb671307eab1.tar.gz
coinos-ui-32fcc461cd43c8907df5e306d520bb671307eab1.zip
svelte 5
Diffstat (limited to 'src/routes/(app)/[username]/receive')
-rw-r--r--src/routes/(app)/[username]/receive/+page.svelte28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/routes/(app)/[username]/receive/+page.svelte b/src/routes/(app)/[username]/receive/+page.svelte
index e9e5ca43..9a696929 100644
--- a/src/routes/(app)/[username]/receive/+page.svelte
+++ b/src/routes/(app)/[username]/receive/+page.svelte
@@ -1,4 +1,6 @@
<script>
+ import { run } from 'svelte/legacy';
+
import { send } from "$lib/socket";
import { btc, post, copy, f, get, types, sat, s, sats } from "$lib/utils";
import { tick, onMount, onDestroy } from "svelte";
@@ -12,12 +14,11 @@
import { t } from "$lib/translations";
import { goto, invalidate } from "$app/navigation";
- export let data;
+ let { data } = $props();
let showOptions;
- let { id, rates, subject, user, src, text } = data;
- $: refresh(data);
+ let { id, rates, subject, user, src, text } = $state(data);
let refresh = (data) => {
({ id, rates, subject, user, src, text } = data);
};
@@ -29,19 +30,15 @@
let qr;
- $: link = [types.bitcoin, types.liquid].includes(type)
- ? text
- : `lightning:${text}`;
- $: txt = [types.bitcoin, types.liquid].includes(type) ? hash : text;
let aid = subject.id;
- let invoice = {
+ let invoice = $state({
aid,
type: types.lightning,
items: [],
user: subject,
- };
- let amount, amountFiat, tip;
+ });
+ let amount = $state(), amountFiat, tip;
let setType = async (type) => {
invoice.type = type;
@@ -75,10 +72,16 @@
};
let newAmount;
- let settingAmount;
+ let settingAmount = $state();
let toggleAmount = () => (settingAmount = !settingAmount);
- let fiat;
let submit;
+ run(() => {
+ refresh(data);
+ });
+ let link = $derived([types.bitcoin, types.liquid].includes(type)
+ ? text
+ : `lightning:${text}`);
+ let txt = $derived([types.bitcoin, types.liquid].includes(type) ? hash : text);
</script>
<div class="invoice container mx-auto max-w-xl px-4 space-y-2">
@@ -115,7 +118,6 @@
<SetAmount
{currency}
{rate}
- {fiat}
{submit}
{settingAmount}
{setAmount}